<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/themes/default/css/umeditor.css" type="text/css"
	rel="stylesheet">

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8"
	src="js/umeditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="js/umeditor.min.js"></script>
<script type="text/javascript" src="js/lang/zh-cn/zh-cn.js"></script>
<script src="js/commit.js"></script>
<script type="text/javascript"src="js/button.js"></script>

	
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
	
	<link rel="stylesheet" href="css/bootstrap-theme.min.css">
	<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
	<script src="js/bootstrap.min.js"></script>
	<style>
	button{
		margin-right:20px;
	}
	
	li span{
		margin-right:20px;
		float:right;
		margin-bottom:5px;
	}
	
	#foot{
		margin-bottom:5px;
	}
	</style>
</head>

  
  <body>
  <div class="site-header jumbotron" style="margin-bottom:0">
  <h1 style="text-align: center">Welcome To BBS!</h1>
  <div style="text-align: right">
    <c:choose>
  <c:when test="${not empty user }">
   <button  class="btn btn-info" id="changepsw">修改密码</button>
  <button  class="btn btn-warning" id="logout">注销</button>
  </c:when>
  <c:otherwise>
  <button  class="btn btn-primary" id="login">登录</button>
  <button  class="btn btn-success" id="register">注册</button>
  </c:otherwise>
  </c:choose> 
  </div>
</div>
<ul class="nav nav-tabs" style="margin-top:0">
  <li role="presentation"><a href="index.action">Home</a></li> 
   <li role="presentation"><a href="content.action?cate=${content.cate.id }">${content.cate.name}</a></li> 
</ul>
  
  <div style="width:600px;margin:0 auto">
    <h2>${content.title }</h2>
    <ul class="list-group">
    <li id="content">
    <div>${content.content_data } </div>
    <br>
    <div id="foot">
    <span>${content.user.username }</span>
    <span>${content.createDate }</span>
    <c:if test="${user.role.id==2 }">
		<span><a href="delContent.action?cate=${content.cate.id }&id=${content.id}">删除</a></span>
	</c:if>
	</div>
   
    
    </li>
	<c:forEach var="commit" items="${commits.rows}">
	<li id="content">
    	<div>${commit.commitData }</div>
    	<br>
    	<div id="foot">
    	<span>${commit.user.username }</span>
    	<span>${commit.date }</span>
    	<c:if test="${user.role.id==2 }">
		<span><a href="delCommit.action?content=${content.id }&id=${commit.id}">删除</a></span>
		</c:if>
		</div>
	</li>
	</c:forEach>
	</ul>
    
    
    
   
   <c:if test="${commits.hasLast() }">
   <a href="page.action?content=${content }&page=${commits.page-1}&rows=${commits.num}">上一页</a>
   </c:if>
   <span>第${commits.page}页</span>
    <c:if test="${commits.hasNext() }">
   <a href="page.action?content=${content }&page=${commits.page+1}&rows=${commits.num}">下一页</a>
   </c:if>
   
   
   
   
   <c:if test="${not empty user }">
   <div style="margin:10px"><h3>回复帖子</h3></div>
   <form action="commit.action" method="post" id="form">
   <input type="hidden" name="content" value="${content.id }">
   <textarea style="width:700px;height:200px;" name="commit"></textarea>
   </form>
<div class="btn-group" style="margin-left:600px;margin-bottom:20px">
			<button  class="btn btn-success"id="submit" >发布</button>
			</div>
</c:if>
</div>
  </body>
</html>
